package com.ruoyi.web.work.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.common.Result;
import com.ruoyi.web.controller.common.query.Querys;
import com.ruoyi.web.work.domain.dbo.UserDO;
import com.ruoyi.web.work.domain.dto.ProcessInputDTO;
import com.ruoyi.web.work.domain.dto.UserQueryDTO;
import com.ruoyi.web.work.service.UserService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;

import static com.ruoyi.web.common.Results.ok;

/**
 * 流转作业卡Controller
 *
 * @author gsx
 * @date 2021-02-28
 */
@RestController
@RequestMapping("/work/user")
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 查询部门下的工人
     */
//    @PreAuthorize("@ss.hasPermi('work:basic:remove')")
    @Log(title = "查询部门下的工人", businessType = BusinessType.INSERT)
    @PostMapping("/queryUserByDept")
    @Transactional(rollbackFor = Exception.class)
    public Result queryUserByDept(@RequestBody UserQueryDTO userQueryDTO)
    {
        QueryWrapper<UserDO> wrapper = Querys.wrapper(userQueryDTO);
        return ok(userService.list(wrapper));
    }
}
